$(function(){
	$('body').delegate('.comment','propertychange input',function(){
		if($(this).val().length > 0){
			$('.send').prop('disabled',false);
			// console.log($(this).val());
		}else{
			$('.send').prop('disabled',true);
		}
	}) //将textarea文本监听事件委托给body
	$('.send').click(function(){
		let text = $('.comment').val()
		let weibo = createEle(text)
		$('.messageList').prepend(weibo)
	})
	$("body").delegate(".infoTop", "click", function () {
	    $(this).text(parseInt($(this).text()) + 1);
	}); //将点击事件委托给body
	$("body").delegate(".infoDown", "click", function () {
	    $(this).text(parseInt($(this).text()) + 1);
	});
	$("body").delegate(".infoDel", "click", function () {
	    $(this).parents(".info").remove();
	});
	
	
	function createEle(text) {
	    var weibo = $("<div class=\"info\">\n" +
	        "            <p class=\"infoText\">"+text+"</p>\n" +
	        "            <p class=\"infoOperation\">\n" +
	        "                <span class=\"infoTime\">"+formartDate()+"</span>\n" +
	        "                <span class=\"infoHandle\">\n" +
	        "                    <a href=\"javascript:;\" class='infoTop'>0</a>\n" +
	        "                    <a href=\"javascript:;\" class='infoDown'>0</a>\n" +
	        "                    <a href=\"javascript:;\" class='infoDel'>删除</a>\n" +
	        "                </span>\n" +
	        "            </p>\n" +
	        "        </div>");
	    return weibo;
	}
	function formartDate(){
		let date = new Date()
		return date.getFullYear()+'-'+
				(date.getMonth() + 1) + '-'+
				 date.getDay() + ' ' +
				 date.getHours()+':'+
				 date.getMinutes()+':'+
				 date.getSeconds()
	}
})